<?php

class Client_Client {
    protected $service;
    public $result;

    public function __construct($className = '') {
        try {
            $options = array(
            	'connection_timeout' => SOAP_CONNECTION_TIMEOUT
            );
            $this->service = @new $className($options);
        } catch (Exception $e) {
            $this->result = $e;
            $this->service = null;
        }
    }

    protected function callMethod($method, $obj, $resultHandler) {
        if (!$this->service) {
            return false;
        }
        try {
            $this->result = $this->service->{$method}($obj);
            return $this->{$resultHandler}();
            if (!$this->result->return) {
                return true;
            }
            return false;
        } catch (Exception $e) {
            $this->result = $e;
            return false;
        }
    }
}
